﻿@using WishlistUtilities;
@{
	PageData["Title"] = "Role Details";
	
	WebSecurity.RequireAuthenticatedUser();
    if (!Roles.IsUserInRole("admin")) {
    	Response.Redirect("~");
    }

    var role = UrlData[0];
	    
    string[] roleList;
    if(role.IsEmpty()) {
       roleList = Roles.GetAllRoles();
    } else {
       roleList = new string[] { role };  
    }
}
<h1>Role Details</h1>
<h2>List of Users By Role</h2>
@{
    foreach(string elementRole in roleList) {
        <h3><strong>Role: @elementRole</strong></h3>
        <ul>        
        @{
            string[] usersInRoleList = Roles.GetUsersInRole(elementRole);
            foreach (var elementUser in usersInRoleList) {
                <div id="master">
                    <li><a href="@Href("~/Admin/Edituser/" + elementUser)">@elementUser</a></li>                    
                </div>
            }
        }
        </ul>
    }
}